﻿import { NgModule } from '@angular/core';
import { NavigationEnd, Router, RouterModule } from '@angular/router';

@NgModule({
    imports: [
        RouterModule.forChild([
            {
                path: '',
                children: [
                    { path: 'codebase', loadChildren: "app/standard-parts/code-base/code-base.module#CodeBaseModule", data: { preload: true } },
                    { path: 'requirement', loadChildren: "app/standard-parts/requirement/requirement.module#RequirementModule", data: { preload: true } },
                    { path: 'managerrequirement', loadChildren: "app/standard-parts/requirement-manager/requirement-manager.module#RequirementManagerModule", data: { preload: true } },
                    { path: 'auditmanagerrequirement', loadChildren: "app/standard-parts/requirement-manager-audit/requirement-manager-audit.module#RequirementManagerAuditModule", data: { preload: true } },
                    { path: 'auditallmanagerrequirement', loadChildren: "app/standard-parts/requirement-manager-audit/requirement-manager-audit.module#RequirementManagerAuditModule", data: { preload: true } },
                    { path: 'managerdepartrequirement', loadChildren: "app/standard-parts/requirement-depart-manager/requirement-depart-manager.module#RequirementDepartManagerModule", data: { preload: true } },
                    { path: 'auditmanagerdepartRequirement', loadChildren: "app/standard-parts/requirement-depart-manager/requirement-depart-manager.module#RequirementDepartManagerModule", data: { preload: true } },
                    { path: 'audit2managerdepartRequirement', loadChildren: "app/standard-parts/requirement-depart-manager/requirement-depart-manager.module#RequirementDepartManagerModule", data: { preload: true } },
                    { path: 'commission', loadChildren: "app/standard-parts/requirement-commission/requirement-commission.module#RequirementCommissionModule", data: { preload: true } },
                    { path: 'workassignment', loadChildren: "app/standard-parts/workassignment/workassignment.module#WorkassignmentModule", data: { preload: true } },
                    { path: 'getrequirement', loadChildren: "app/standard-parts/requirement-get/requirement-get.module#RequirementGetModule", data: { preload: true } },
                    { path: 'auditgetrequirement', loadChildren: "app/standard-parts/requirement-get-audit/requirement-get-audit.module#RequirementGetAuditModule", data: { preload: true } },
                    { path: 'audit2getrequirement', loadChildren: "app/standard-parts/requirement-get-audit/requirement-get-audit.module#RequirementGetAuditModule", data: { preload: true } },
                    { path: 'auditallgetrequirement', loadChildren: "app/standard-parts/requirement-get-audit/requirement-get-audit.module#RequirementGetAuditModule", data: { preload: true } },
                    { path: 'stockforstandards', loadChildren: "app/standard-parts/stockforstandards/stockforstandards.module#StockforstandardsModule", data: { preload: true } },
                    { path: 'auditauthority', loadChildren: "app/standard-parts/auditauthority/auditauthority.module#AuditauthorityModule", data: { preload: true } },
                    { path: 'outmapfetch', loadChildren: "app/standard-parts/fetchmapout/fetchmapout.module#FetchmapoutModule", data: { preload: true } },
                    { path: 'fetchimport', loadChildren: "app/standard-parts/fetchimport/fetchimport.module#FetchimportModule", data: { preload: true } },
                ]
            }
        ])
    ],
    exports: [
        RouterModule
    ]
})
export class StandardPartsRoutingModule {

    constructor(
        private router: Router
    ) {
        router.events.subscribe((event) => {
            if (event instanceof NavigationEnd) {
                window.scroll(0, 0);
            }
        });
    }
}
